home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DShader.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  7.5 KB  |  285 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DShader.h
  3.  
  4.      Contains:    QuickDraw 3D Shader / Color Routines                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DSHADER__
  18. #define __QD3DSHADER__
  19.  
  20. #ifndef __QD3D__
  21. #include <QD3D.h>
  22. #endif
  23.  
  24.  
  25.  
  26. #if PRAGMA_ONCE
  27. #pragma once
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37.  
  38. #if PRAGMA_STRUCT_ALIGN
  39.     #pragma options align=power
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41.     #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43.     #pragma pack(2)
  44. #endif
  45.  
  46. #if PRAGMA_ENUM_ALWAYSINT
  47.     #pragma enumsalwaysint on
  48. #elif PRAGMA_ENUM_OPTIONS
  49.     #pragma option enum=int
  50. #elif PRAGMA_ENUM_PACK
  51.     #if __option(pack_enums)
  52.         #define PRAGMA_ENUM_PACK__QD3DSHADER__
  53.     #endif
  54.     #pragma options(!pack_enums)
  55. #endif
  56.  
  57. /******************************************************************************
  58.  **                                                                             **
  59.  **                                RGB Color routines                             **
  60.  **                                                                             **
  61.  *****************************************************************************/
  62. EXTERN_API_C( TQ3ColorRGB *)
  63. Q3ColorRGB_Set                    (TQ3ColorRGB *            color,
  64.                                  float                     r,
  65.                                  float                     g,
  66.                                  float                     b);
  67.  
  68. EXTERN_API_C( TQ3ColorARGB *)
  69. Q3ColorARGB_Set                    (TQ3ColorARGB *            color,
  70.                                  float                     a,
  71.                                  float                     r,
  72.                                  float                     g,
  73.                                  float                     b);
  74.  
  75. EXTERN_API_C( TQ3ColorRGB *)
  76. Q3ColorRGB_Add                    (const TQ3ColorRGB *    c1,
  77.                                  const TQ3ColorRGB *    c2,
  78.                                  TQ3ColorRGB *            result);
  79.  
  80. EXTERN_API_C( TQ3ColorRGB *)
  81. Q3ColorRGB_Subtract                (const TQ3ColorRGB *    c1,
  82.                                  const TQ3ColorRGB *    c2,
  83.                                  TQ3ColorRGB *            result);
  84.  
  85. EXTERN_API_C( TQ3ColorRGB *)
  86. Q3ColorRGB_Scale                (const TQ3ColorRGB *    color,
  87.                                  float                     scale,
  88.                                  TQ3ColorRGB *            result);
  89.  
  90. EXTERN_API_C( TQ3ColorRGB *)
  91. Q3ColorRGB_Clamp                (const TQ3ColorRGB *    color,
  92.                                  TQ3ColorRGB *            result);
  93.  
  94. EXTERN_API_C( TQ3ColorRGB *)
  95. Q3ColorRGB_Lerp                    (const TQ3ColorRGB *    first,
  96.                                  const TQ3ColorRGB *    last,
  97.                                  float                     alpha,
  98.                                  TQ3ColorRGB *            result);
  99.  
  100. EXTERN_API_C( TQ3ColorRGB *)
  101. Q3ColorRGB_Accumulate            (const TQ3ColorRGB *    src,
  102.                                  TQ3ColorRGB *            result);
  103.  
  104. EXTERN_API_C( float *)
  105. Q3ColorRGB_Luminance            (const TQ3ColorRGB *    color,
  106.                                  float *                luminance);
  107.  
  108. /******************************************************************************
  109.  **                                                                             **
  110.  **                                Shader Types                                 **
  111.  **                                                                             **
  112.  *****************************************************************************/
  113.  
  114. enum TQ3ShaderUVBoundary {
  115.     kQ3ShaderUVBoundaryWrap        = 0,
  116.     kQ3ShaderUVBoundaryClamp    = 1
  117. };
  118. typedef enum TQ3ShaderUVBoundary TQ3ShaderUVBoundary;
  119.  
  120.  
  121. /******************************************************************************
  122.  **                                                                             **
  123.  **                                Shader Routines                                 **
  124.  **                                                                             **
  125.  *****************************************************************************/
  126. EXTERN_API_C( TQ3ObjectType )
  127. Q3Shader_GetType                (TQ3ShaderObject         shader);
  128.  
  129. EXTERN_API_C( TQ3Status )
  130. Q3Shader_Submit                    (TQ3ShaderObject         shader,
  131.                                  TQ3ViewObject             view);
  132.  
  133. EXTERN_API_C( TQ3Status )
  134. Q3Shader_SetUVTransform            (TQ3ShaderObject         shader,
  135.                                  const TQ3Matrix3x3 *    uvTransform);
  136.  
  137. EXTERN_API_C( TQ3Status )
  138. Q3Shader_GetUVTransform            (TQ3ShaderObject         shader,
  139.                                  TQ3Matrix3x3 *            uvTransform);
  140.  
  141. EXTERN_API_C( TQ3Status )
  142. Q3Shader_SetUBoundary            (TQ3ShaderObject         shader,
  143.                                  TQ3ShaderUVBoundary     uBoundary);
  144.  
  145. EXTERN_API_C( TQ3Status )
  146. Q3Shader_SetVBoundary            (TQ3ShaderObject         shader,
  147.                                  TQ3ShaderUVBoundary     vBoundary);
  148.  
  149. EXTERN_API_C( TQ3Status )
  150. Q3Shader_GetUBoundary            (TQ3ShaderObject         shader,
  151.                                  TQ3ShaderUVBoundary *    uBoundary);
  152.  
  153. EXTERN_API_C( TQ3Status )
  154. Q3Shader_GetVBoundary            (TQ3ShaderObject         shader,
  155.                                  TQ3ShaderUVBoundary *    vBoundary);
  156.  
  157.  
  158. /******************************************************************************
  159.  **                                                                             **
  160.  **                            Illumination Shader    Classes                         **
  161.  **                                                                             **
  162.  *****************************************************************************/
  163. EXTERN_API_C( TQ3ObjectType )
  164. Q3IlluminationShader_GetType    (TQ3ShaderObject         shader);
  165.  
  166. EXTERN_API_C( TQ3ShaderObject )
  167. Q3PhongIllumination_New            (void);
  168.  
  169. EXTERN_API_C( TQ3ShaderObject )
  170. Q3LambertIllumination_New        (void);
  171.  
  172. EXTERN_API_C( TQ3ShaderObject )
  173. Q3NULLIllumination_New            (void);
  174.  
  175.  
  176. /******************************************************************************
  177.  **                                                                             **
  178.  **                                 Surface Shader                                 **
  179.  **                                                                             **
  180.  *****************************************************************************/
  181. EXTERN_API_C( TQ3ObjectType )
  182. Q3SurfaceShader_GetType            (TQ3SurfaceShaderObject  shader);
  183.  
  184.  
  185. /******************************************************************************
  186.  **                                                                             **
  187.  **                                Texture Shader                                 **
  188.  **                                                                             **
  189.  *****************************************************************************/
  190. EXTERN_API_C( TQ3ShaderObject )
  191. Q3TextureShader_New                (TQ3TextureObject         texture);
  192.  
  193. EXTERN_API_C( TQ3Status )
  194. Q3TextureShader_GetTexture        (TQ3ShaderObject         shader,
  195.                                  TQ3TextureObject *        texture);
  196.  
  197. EXTERN_API_C( TQ3Status )
  198. Q3TextureShader_SetTexture        (TQ3ShaderObject         shader,
  199.                                  TQ3TextureObject         texture);
  200.  
  201.  
  202. /******************************************************************************
  203.  **                                                                             **
  204.  **                                Texture Objects                                 **
  205.  **                                                                             **
  206.  *****************************************************************************/
  207. EXTERN_API_C( TQ3ObjectType )
  208. Q3Texture_GetType                (TQ3TextureObject         texture);
  209.  
  210. EXTERN_API_C( TQ3Status )
  211. Q3Texture_GetWidth                (TQ3TextureObject         texture,
  212.                                  unsigned long *        width);
  213.  
  214. EXTERN_API_C( TQ3Status )
  215. Q3Texture_GetHeight                (TQ3TextureObject         texture,
  216.                                  unsigned long *        height);
  217.  
  218.  
  219. /******************************************************************************
  220.  **                                                                             **
  221.  **                                Pixmap Texture                                 **
  222.  **                                                                             **
  223.  *****************************************************************************/
  224. EXTERN_API_C( TQ3TextureObject )
  225. Q3PixmapTexture_New                (const TQ3StoragePixmap * pixmap);
  226.  
  227. EXTERN_API_C( TQ3Status )
  228. Q3PixmapTexture_GetPixmap        (TQ3TextureObject         texture,
  229.                                  TQ3StoragePixmap *        pixmap);
  230.  
  231. EXTERN_API_C( TQ3Status )
  232. Q3PixmapTexture_SetPixmap        (TQ3TextureObject         texture,
  233.                                  const TQ3StoragePixmap * pixmap);
  234.  
  235.  
  236. /******************************************************************************
  237.  **                                                                             **
  238.  **                                Mipmap Texture                                 **
  239.  **                                                                             **
  240.  *****************************************************************************/
  241. EXTERN_API_C( TQ3TextureObject )
  242. Q3MipmapTexture_New                (const TQ3Mipmap *        mipmap);
  243.  
  244. EXTERN_API_C( TQ3Status )
  245. Q3MipmapTexture_GetMipmap        (TQ3TextureObject         texture,
  246.                                  TQ3Mipmap *            mipmap);
  247.  
  248. EXTERN_API_C( TQ3Status )
  249. Q3MipmapTexture_SetMipmap        (TQ3TextureObject         texture,
  250.                                  const TQ3Mipmap *        mipmap);
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257. #if PRAGMA_ENUM_ALWAYSINT
  258.     #pragma enumsalwaysint reset
  259. #elif PRAGMA_ENUM_OPTIONS
  260.     #pragma option enum=reset
  261. #elif defined(PRAGMA_ENUM_PACK__QD3DSHADER__)
  262.     #pragma options(pack_enums)
  263. #endif
  264.  
  265. #if PRAGMA_STRUCT_ALIGN
  266.     #pragma options align=reset
  267. #elif PRAGMA_STRUCT_PACKPUSH
  268.     #pragma pack(pop)
  269. #elif PRAGMA_STRUCT_PACK
  270.     #pragma pack()
  271. #endif
  272.  
  273. #ifdef PRAGMA_IMPORT_OFF
  274. #pragma import off
  275. #elif PRAGMA_IMPORT
  276. #pragma import reset
  277. #endif
  278.  
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282.  
  283. #endif /* __QD3DSHADER__ */
  284.  
  285.